@extends('admin.layout.base')

@section('main')
    @if (count($errors) > 0)
        <div class="alert alert-danger">
            <strong>糟糕!</strong> 发生以下错误<br><br>
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <h1 class="page-header">配置管理</h1>
    <a href="{{ route('admin.configs.create') }}" class="btn btn-primary pull-right">添加配置</a>
    <form action="{{ url('admin/configs/process') }}" method="post" class="form-inline">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <select class="form-control" name="action">
            <option value="">批量操作</option>
            <option value="delete">删除</option>
        </select>
        <button type="submit" class="btn btn-default">应用</button>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>
                    <div class="checkbox">
                        <input id="select-all" type="checkbox">
                        <label for="select-all">
                            全选
                        </label>
                    </div>
                </th>
                <th>名字</th>
                <th>id</th>
                <th>骗审</th>
                <th>骗赞</th>
                <th>Banner</th>
                <th>插屏</th>
                <th>标题</th>
                <th>内容</th>
                <th>延时</th>
                <th>跳转</th>
            </tr>
            </thead>
            <tbody>
            @foreach($configs as $config)
                <tr>
                    <td>
                        <div class="checkbox">
                            <input id="checkbox-{{ $config->id }}" type="checkbox" name="ids[]"
                                   value="{{ $config->id }}">
                            <label for="checkbox-{{ $config->id }}"></label>
                        </div>
                    </td>
                    <td>
                        <a href="{{ route('admin.configs.edit', $config->id) }}">
                            {{ $config->name }}
                        </a>
                    </td>
                    <td>
                        {{ $config->res_id }}
                    </td>
                    <td>
                        {{ $config->check?'是':'否' }}
                    </td>
                    <td>
                        {{ $config->rate ? '是':'否' }}
                    </td>
                    <td>
                        {{ $config->banner_id }}
                    </td>
                    <td>
                        {{ $config->interstitial_id }}
                    </td>
                    <td>
                        {{ $config->alert_title }}
                    </td>
                    <td>
                        {{ $config->alert_message }}
                    </td>
                    <td>
                        {{ $config->alert_delay }}
                    </td>
                    <td>
                        <a href="{{ $config->alert_url }}" target="_blank">查看</a>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        {!! $configs->render() !!}
    </form>
@stop